// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ilm
{
	public sealed class IlmMigrateToDataTiersRequestParameters : RequestParameters<IlmMigrateToDataTiersRequestParameters>
	{
		[JsonIgnore]
		public bool? DryRun { get => Q<bool?>("dry_run"); set => Q("dry_run", value); }
	}

	public sealed partial class IlmMigrateToDataTiersRequest : PlainRequestBase<IlmMigrateToDataTiersRequestParameters>
	{
		internal override ApiUrls ApiUrls => ApiUrlsLookups.IndexLifecycleManagementMigrateToDataTiers;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		[JsonIgnore]
		public bool? DryRun { get => Q<bool?>("dry_run"); set => Q("dry_run", value); }

		[JsonInclude]
		[JsonPropertyName("legacy_template_to_delete")]
		public string? LegacyTemplateToDelete { get; set; }

		[JsonInclude]
		[JsonPropertyName("node_attribute")]
		public string? NodeAttribute { get; set; }
	}

	public sealed partial class IlmMigrateToDataTiersRequestDescriptor : RequestDescriptorBase<IlmMigrateToDataTiersRequestDescriptor, IlmMigrateToDataTiersRequestParameters>
	{
		internal IlmMigrateToDataTiersRequestDescriptor(Action<IlmMigrateToDataTiersRequestDescriptor> configure) => configure.Invoke(this);
		public IlmMigrateToDataTiersRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.IndexLifecycleManagementMigrateToDataTiers;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public IlmMigrateToDataTiersRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun);
		private string? LegacyTemplateToDeleteValue { get; set; }

		private string? NodeAttributeValue { get; set; }

		public IlmMigrateToDataTiersRequestDescriptor LegacyTemplateToDelete(string? legacyTemplateToDelete)
		{
			LegacyTemplateToDeleteValue = legacyTemplateToDelete;
			return Self;
		}

		public IlmMigrateToDataTiersRequestDescriptor NodeAttribute(string? nodeAttribute)
		{
			NodeAttributeValue = nodeAttribute;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (!string.IsNullOrEmpty(LegacyTemplateToDeleteValue))
			{
				writer.WritePropertyName("legacy_template_to_delete");
				writer.WriteStringValue(LegacyTemplateToDeleteValue);
			}

			if (!string.IsNullOrEmpty(NodeAttributeValue))
			{
				writer.WritePropertyName("node_attribute");
				writer.WriteStringValue(NodeAttributeValue);
			}

			writer.WriteEndObject();
		}
	}
}